﻿<html DIR="LTR" xmlns:tool="http://www.microsoft.com/tooltip" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ddue="http://ddue.schemas.microsoft.com/authoring/2003/5" xmlns:MSHelp="http://msdn.microsoft.com/mshelp">
  <head>
    <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=utf-8" />
    <META NAME="save" CONTENT="history" />
    <title>Microsoft SQL Remote Blob Storage Samples</title>
    
    
    
    <style TYPE="text/css">
body
{
background: #FFFFFF;
color: #000000;
font-family:    Verdana;
font-size: medium;
font-style: normal;
font-weight: normal;
margin-top: 0;
margin-bottom:  0;
margin-left:    0;
margin-right:   0;
width:  100%;
}

div.#mainSection
{
font-size: 70%;
width: 100%;
padding-left:    10;
margin-right: 10;
}

div.#mainBody
{
font-size: 90%;
margin-top: 10;
padding-bottom: 20;
}

div.#header
{
background-color: #D2D2D2;
padding-top:    0;
padding-bottom: 0;
padding-left:   10;
padding-right:  0;
width:          100%;
}

div.#header table
{
border-bottom-color: #C8CDDE;
border-bottom-style: solid;
border-bottom-width: 1;
width:  100%;
}

span.#runningHeaderText
{
color: #003399;
font-size: 90%;
}

span.#nsrTitle
{
/*    color: #003399;*/
font-size: 120%;
font-weight: 600;
}

div.#header table td
{
color: #000000;
font-size: 70%;
margin-top: 0;
margin-bottom:  0;
padding-right: 20;
}

div.#header table tr.#headerTableRow3 td
{
padding-bottom: 2;
padding-top: 5;
}

div.#header table.#bottomTable
{
border-top-color: #FFFFFF;
border-top-style: solid;
border-top-width: 1;
text-align: left;
}

div.#footer
{
font-size: 90%;
margin-top: 0;
margin-bottom:  0;
margin-left:    -5;
margin-right:   0;
padding-top:    2;
padding-bottom: 2;
padding-left:   0;
padding-right:  0;
width:  100%;
}

hr.#footerHR
{
border-bottom-color: #EEEEFF;
border-bottom-style: solid;
border-bottom-width: 1;
border-top-color: C8CDDE;
border-top-style: solid;
border-top-width: 1;
height: 3;
color: #D2D2D2;
}

div.section
{
padding-top:    2;
padding-bottom: 2;
padding-right:  15;
width:  100%;
}

.heading
{
color:          #000000;
font-weight:    bold;
margin-top:     18;
margin-bottom:  8;
}

h1.heading
{
color: #000000;
font-size:  150%;
}

.subHeading
{
color:          #000000;
font-weight:    bold;
font-size:      150%;
margin-bottom:  4;
}

h2.subHeading
{
color:          #000000;
font-weight:    bold;
font-size:      130%;
}
h3.subHeading
{
color:  #000000;
font-size: 125%;
font-weight: bold;
}

h4.subHeading
{
color: #000000;
font-size: 110%;
font-weight: bold;
}

h4.procedureHeading
{
color: #000080;
font-size: 110%;
font-weight: bold;
}

h5.subHeading
{
color: #000000;
font-size: 100%;
font-weight: bold;
}

img
{
padding-bottom: 10;
}

img.toggle
{
border: 0;
margin-right: 5;
padding-bottom: 10;
}

img.copyCodeImage
{
border: 0;
margin: 1;
margin-right: 3;
padding-bottom: 10;
}

img.downloadCodeImage
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.viewCodeImage
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.note
{
border: 0;
margin-right: 3;
padding-bottom: 10;
}

img.#membersOptionsFilterImage
{
border: 0;
margin-left: 10;
vertical-align: middle;
padding-bottom: 10;
}

img.#toggleAllImage
{
margin-left: 4;
vertical-align: middle;
padding-bottom: 10;
}

div.#mainSection table
{
border: 0;
font-size: 100%;
width:  100%;
margin-top: 5px;
margin-bottom: 15px;
}

div.#mainSection table tr
{
vertical-align: top;
}

div.#mainSection table th
{
text-align: left;
background: #D8D8D8;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1;
color: #000000;
padding-left: 5;
padding-right: 5;
}

div.#mainSection table td
{
background: #F2F2F2;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
}

div.#mainSection table td.imageCell
{
white-space: nowrap;
}

div.code
{
width: 98%;
}

div.code table
{
border: 0;
font-size: 95%;
margin-bottom: 5;
width: 100%
}

div.code table th
{
text-align: left;
background: #D8D8D8;
border-bottom-color: #D8D8D8;
border-bottom-style: solid;
border-bottom-width: 1;
color: #000000;
font-weight: bold;
padding-left: 5;
padding-right: 5;
}

div.code table td
{
background: #CCCCCC;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
padding-top: 5;
}

div.alert
{
margin-left: 10;
width: 98%;
}

div.alert table
{
border: 1;
font-size: 100%;
width:  100%;
border: solid 1 #DEDFEF;
}

div.alert table th
{
text-align: left;
background: #D8D8D8;
border-bottom-width: 0;
color: #000000;
padding-left: 5;
padding-right: 5;
border: solid 1 #DEDFEF;
}

div.alert table td
{
background: #FFFFFF;
border-top-color: #D8D8D8;
border-top-style: solid;
border-top-width: 1;
padding-left: 5;
padding-right: 5;
border: solid 1 #DEDFEF;
}

span.copyCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
float: right;
display: inline;
text-align: right;
}

.downloadCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
}

.viewCode
{
color: #0000ff;
font-size: 90%;
font-weight: normal;
cursor: hand;
}

div.code pre
{
font-family:    Monospace, Courier New, Courier;
font-size: 105%;
color:  #000000;
}

code
{
font-family:    Monospace, Courier New, Courier;
font-size: 105%;
color:  #000000;
}

dl
{
margin-top: 0;
padding-left:   1;
}

dd
{
margin-bottom:  0;
margin-left:    0;
padding-left:   20;
}

dd p
{
margin-top: 5;
}

ul
{
margin-left: 17;
list-style-type: disc;
}

ul ul
{
margin-bottom: 4;
margin-left: 17;
margin-top: 3;
list-style-type: disc;
}

ol
{
margin-left: 24;
list-style-type: decimal;
}

ol ol
{
margin-left: 24;
margin-top: 3;
list-style-type: lower-alpha;
}

li
{
margin-top: 0;
margin-bottom: 0;
padding-bottom: 0;
padding-top: 0;
margin-left: 5;
}

p
{
margin-bottom: 15;
}

.tip
{
color:  #0000FF;
font-style: italic;
cursor:hand;
text-decoration:underline;
}

.math
{
font-family: Times New Roman;
font-size: 125%
}
.sourceCodeList
{
font-family: Verdana;
font-size: 90%;
}

pre.viewCode
{
width: 100%;
overflow: auto;
}

li:hover table, li.over table
{
background-color: #C0C0C0;
}

li:hover ul, li.over ul
{
background-color: #d2d2d2;
border: 1px solid #000;
display: block;
}
            </style>
  </head>
  <body>
    <!--Topic built:06/16/2008 01:41:30-->

    <div id="header">
      <table width="100%" id="topTable"><tr>
          <td align="left">
            <span id="nsrTitle">SQL Remote Blob Storage (RBS) Samples</span>
          </td>
          <td align="right">
            <span id="headfb" class="feedbackhead">
            </span>
          </td>
        </tr></table>
      
      
      
    </div>
    <div id="mainSection">
      <div id="mainBody"><p>7/10/2008</p>
        
        <font color="DarkGray"> </font><p /> 
        <span id="changeHistory">
        </span>
    <p>
      This sample works only with SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2008.
    </p>
    <p>
    RBS is a library API set that is designed to move storage of BLOB data from database servers to external Content Addressable Stores (CAS). A reference to the blob is stored in the database. An application stores and accesses blob data by calling into the RBS client library. RBS manages the lifecycle of the blob e.g. doing garbage collection as and when needed.
    </p>
    <p>The following samples are included:</p>
    <ol>
    <li>
        Remote Blob Storage Sample Application Application.exe. This contains implementations of Simple Store / Fetch, Custom Store (specifying collections / blob stores), Store / Fetch using Push streaming, Store / Fetch using Pull streaming, and an example that uses the System.IO.Stream APIs to do asynchronous reads from the blob store.
    </li>
    <li>
         File Store sample provider <code>Microsoft.Data.BlobStores.FileBlobStore</code>. This file contains the basic implementation of a provider that uses NTFS files as the blob store. This is a demonstration provider for development and testing purposes only and should not be used on production systems.<br />
      </li><li>
        <code>InstallProvider.exe</code> utility application. This is a generic utility tool to aid in correctly installing, registering and uninstalling providers on both on the client and the server.<br />
      </li></ol>
      
      <p>See the RBS team blog at <a href="http://blogs.msdn.com/sqlrbs">http://blogs.msdn.com/sqlrbs</a> for the latest news regarding RBS.</p>
      
    <p>Install directory: C:\Program Files\Microsoft SQL Server\100\Samples\Engine\RBS\</p>
    <p>
      SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see <a href="html/e8117979-fe03-441e-be85-894fa616227a.htm">Considerations for Installing SQL Server Samples and Sample Databases</a>. </p>
  <h1 class="heading">Scenario</h1><div id="sectionSection0" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">Jane is a developer for Adventure Works Cycles. She has to store documents in an external CAS store but still wants to utilize the relational capabilities of SQL Server without incurring the cost of manually keeping track of the external blobs.</p>
      <p xmlns="">Joe is a developer for a firm that manufactures Content Addressable Store hardware. He wants to create a provider library to allow applications that are RBS enabled to utilise his firm's technology.</p>
    </content></div><h1 class="heading">Languages</h1><div id="sectionSection1" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">
        Transact-SQL and Visual C#.</p>
    </content></div><h1 class="heading">Features</h1><div id="sectionSection2" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">The Remote Blob Storage samples use the following features of Microsoft SQL Server.</p>
      <table width="100%" cellspacing="0" cellpadding="0" border="1" style="background-color: #CCCCCC;" xmlns=""><tr>
            <th>
              Application Area
            </th>
            <th>
              Features
            </th>
          </tr><tr>
          <td>
            <p>Overall</p>
          </td>
          <td>
            <p>Remote Blob Storage, CLR, Transact-SQL </p>
          </td>
        </tr></table>
    </content></div><h1 class="heading">Prerequisites</h1><div id="sectionSection3" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">Before running this sample, make sure the following software is installed:</p>
      <ul xmlns=""><li>
          
            Microsoft SQL Server or Microsoft SQL Server Express. You can obtain SQL Server Express free of charge from the SQL Server Express Documentation and Samples <a href="http://go.microsoft.com/fwlink/?LinkId=31046" alt=""><linkText xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">Web site</linkText></a>. <br />
        </li><li>
          The <b>SQL Server Remote Blob Store</b> installation package available as part of the feature packs included with SQL Server, also available at the SQL Server Feature Pack <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=089A9DAD-E2DF-43E9-9CD8-C06320520B40&displaylang=en" alt=""><linkText xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">Web site</linkText></a>.<br />
        </li><li>
          The SQL Server Database Engine samples. These samples are included with SQL Server. You can download the latest version of the samples at the SQL Server Developer <a href="http://go.microsoft.com/fwlink/?linkid=62796" alt=""><linkText xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">Web site</linkText></a>.<br />
        </li><li>
          
            .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. See <b>Installing the .NET Framework Documentation</b>.<br />
        </li></ul>
    </content></div>
    
    <h1 class="heading">Install File Store Provider from the provided binaries</h1><div id="sectionSection5" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <h4 class="procedureHeading" xmlns="">To install the File Store Provider</h4><div id="procedureSectionEBBHBHA" class="section" xmlns=""><ol>
            <li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At a command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the RBS sample directory.  At the command prompt, run the following command:</p>
              <p xmlns="">
                <code>notepad Binaries\InstallProvider.cmd </code>
              </p>
            </content>
            </li>

            <li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">You can then edit the parameters in the command script for your setup. Each parameter should be documented in the command script. Once your custom configuration is complete, at the command prompt run the following command:</p>
              <p xmlns="">
                <code>Binaries\InstallProvider.cmd </code>
              </p>
            </content>
          </li>
          </ol></div>
    </content></div>

    <h1 class="heading">Execute the sample application</h1><div id="sectionSection5" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <h4 class="procedureHeading" xmlns="">To run the sample application</h4><div id="procedureSectionEBBHBHA" class="section" xmlns=""><ol>
            <li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">To successfully run the sample application, a blob store provider must be installed. See the above section on installing the File Store Provider for instructions.
 At a command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the RBS sample directory.  At the command prompt, run the following command:</p>
              <p xmlns="">
                <code>notepad Binaries\Application.exe.config</code>
              </p>
            </content>
            </li>

            <li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">You can then edit the connection string named 'application' to connect to the SQL Server and Catalog that RBS is installed on. Once your custom configuration is complete, at the command prompt run the following command:</p>
              <p xmlns="">
                <code>Binaries\Application.exe </code>
              </p>
            </content>
          </li>
          </ol></div>
    </content></div>


    <h1 class="heading">Building the Samples</h1><div id="sectionSection4" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">
          <h4 class="procedureHeading" xmlns="">To build the Remote Blob Storage samples</h4><div id="procedureSectionEBBJBHA" class="section" xmlns=""><ol><li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">Compile the sample by using Visual Studio 2008 and the provided Visual Studio solution, or by using Microsoft MSBuild, which is included in the .NET Framework SDK 2.0. Run commands similar to the following at a .NET Framework command prompt:</p>
              <p xmlns="">
                <code>msbuild /nologo /verbosity:quiet /property:Configuration=Debug Source\RBS_Samples.sln</code>
              </p>
            </content>
          </li>
         </ol></div>
    </content></div>
    
    <h1 class="heading">Removing the installed File Store Provider.</h1><div id="sectionSection6" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <h4 class="procedureHeading" xmlns="">To remove the installed File Store Provider</h4><div id="procedureSectionEBBFBHA" class="section" xmlns=""><ol>

         <li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">At a command prompt, use the change directory (CD) command to change the current folder of the command prompt window to the RBS sample directory.  At the command prompt, run the following command:</p>
              <p xmlns="">
                <code>notepad Binaries\UninstallProvider.cmd </code>
              </p>
            </content>
            </li>

            <li>
            <content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
              <p xmlns="">You can then edit the parameters in the command script for your setup. Each parameter should be documented in the command script. Once your custom configuration is complete, at the command prompt run the following command:</p>
              <p xmlns="">
                <code>Binaries\UninstallProvider.cmd </code>
              </p>
            </content>
          </li>
 
          
          </ol></div>
    </content></div><h1 class="heading">Comments</h1><div id="sectionSection7" class="section"><content xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5">
      <p xmlns="">
        Samples are provided for educational purposes only. They are not intended to be used in a production environment and have not been tested in a production environment. Microsoft does not provide technical support for these samples. Sample applications and assemblies should not be connected to or used with your production SQL Server database or your report server without the permission of the system administrator.
      </p>
    </content></div>
    </div><!--[if gte IE 5]>
            <tool:tip element="seeAlsoToolTip" avoidmouse="false"/><tool:tip element="languageFilterToolTip" avoidmouse="false"/><tool:tip element="roleInfoSpan" avoidmouse="false"/>
        <![endif]-->
      <div id="footer">
            © 2008 Microsoft Corporation. All rights reserved.
      </div>
      </div>
  </body>
</html>